* @y: the y coordinate of the child
*
* Gets the child in the (@x, @y) position. Both @x and @y are
- * assumed to be relative to the allocation of @box.
+ * assumed to be relative to the origin of @box.
*
* Returns: (transfer none) (nullable): the child widget, which will
* always be a #GtkFlowBoxChild or %NULL in case no child widget
gint x,
gint y)
{
- GtkWidget *child;
- GSequenceIter *iter;
- GtkAllocation allocation;
-
- for (iter = g_sequence_get_begin_iter (BOX_PRIV (box)->children);
- !g_sequence_iter_is_end (iter);
- iter = g_sequence_iter_next (iter))
- {
- child = g_sequence_get (iter);
- if (!child_is_visible (child))
- continue;
+ GtkWidget *child = gtk_widget_pick (GTK_WIDGET (box), x, y);
- gtk_widget_get_allocation (child, &allocation);
- if (gdk_rectangle_contains_point (&allocation, x, y))
- return GTK_FLOW_BOX_CHILD (child);
- }
+ if (!child)
+ return NULL;
- return NULL;
+ return (GtkFlowBoxChild *)gtk_widget_get_ancestor (child, GTK_TYPE_FLOW_BOX_CHILD);
}
/**